/*
>> AnisoPixelToPixelOp.s
>>
>> Anisotropic pixel operation skeleton, allowing buffer and scalar inputs,
>> and buffer outputs
>>
>> Author: Wouter Caarls
>> Date:   15-06-2006
*/

#include "ilpstrategies.h"

void AnisoPixelToPixelOp(argcode_t *argcode, int arguments, code body)
{
  int ii, x, y;
  y = 0;

  for (ii=0; ii < arguments; ii++)
  {
    argcode[ii].state.buffer = 1;
    argcode[ii].state.delay = 0;
    argcode[ii].state.state = 0;
    argcode[ii].tokens.initial = 0;
    argcode[ii].tokens.final = 0;

    if (argcode[ii].argtype == ARG_STREAM_IN || argcode[ii].argtype == ARG_STREAM_OUT)
    {
      body = replace(argcode[ii].id, `&($@argcode[ii].id)[0][_ii]`, body);
    }
  }

  declarearguments(argcode, arguments);

  /* And proceed with the usual line by line execution */
  prologue {
  };

  repeat {
    int _ii, x=0;

    #pragma TCS_unroll=16
    for (_ii=0; _ii < lbl_hpixels; _ii++)
    {
      $@body;
      x++;
    }

    y++;
  };

  epilogue {
   finalizearguments(argcode, arguments);
  };
}
